#include <stdio.h>
#include <stdlib.h>
#include "../Includes/Driver.h"
#include "../Includes/Messaging.h"
#include "../Includes/Window.h"
#include <unistd.h>

/// <summary>
/// Macros
/// </summary>
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)

/// <summary>
/// TODO
/// </summary>
int RECTUnion(RectanglePtr rect1, RectanglePtr rect2)
{
	if (rect1 == NULL || rect2 == NULL)
		return -1;
	rect1->left = MIN(rect1->left, rect2->left);
	rect1->top = MIN(rect1->top, rect2->top);
	rect1->right = MAX(rect1->right, rect2->right);
	rect1->bottom = MAX(rect1->bottom, rect2->bottom);
	return 0;
}
